package cn.edu.tsc.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import cn.edu.tsc.pojo.User;
import cn.edu.tsc.util.DBUtil;

public class UserDao {

    public int insertUser(User user) {
        String sql = "insert into t_user values(null,?,?,?)";
        int n = common.update(sql, user.getName(), user.getPassword(), user.getEmail());
        return n;
    }


    public boolean selectUser(User user) {
        String sql = "select * from t_user where name = ? and password = ?";
        boolean flag = false;
        User instance = common.getInstance(User.class, sql, user.getName(), user.getPassword());

        if (instance != null)
            flag = true;
        return flag;
    }


}
